Deleted database record reuse

ABSTRACT

A computer-implemented method for reusing deleted database records includes, receiving, by a database manager executing within a computing device, a first query request to insert, into a database table, a first set of database records. The database manager identifies a first set of entries within a journal log bundle. The database manager also determines, in response to identifying a first set of entries, that there is a third set of deleted database records located on a same page as a second set of database records. The database manager also, in response to determining that there is a third set of deleted database records located on a same page as the second set of database records, inserts into the database table the first set of database records using the third set of deleted database records.

BACKGROUND

This disclosure relates generally to database management systems, andmore specifically, to reusing deleted database records.

Database manager modules may perform the two functions of accessing andmodifying data from a database table within a file. Database managermodules may access data by selecting and delivering particular databaserecords requested by a user based on a query statement. The querystatement specifies the particular attributes, table, and queryconditions that a user desires. Database manager modules may modify databy inserting (writing) new database records (rows) in a table, updating(writing) values within the database records, or deleting particulardatabase records from a table matching specified query conditions.

When a new database record is inserted into a database table, databasemanager modules may employ an operation called “Reuse Deleted” (RD)records (e.g., REUSEDLT (*YES)). The RD records operation allows adatabase manager module to insert a new database record by using apreviously deleted database record. When a database record is deletedthrough a delete operation, the database manager module may flag thedatabase record as deleted. This means that the database record maystill exist in the database even though the flagged database recordscannot be accessed through a query. Accordingly, when the insert and RDrecords operations occur, the delete flags may be released on thepreviously deleted record such that the insert operation may access andreuse the previously deleted record.

SUMMARY

One or more embodiments are directed to a computer-implemented methodfor reusing deleted database records. The method can include receiving,by a database manager executing within a computing device, a first queryrequest to insert, into a database table, a first set of databaserecords. The method can include identifying, by the database manager, afirst set of entries within a journal log bundle, the first set ofentries corresponding to a second set of database records that have beenmodified within the database table. In response to identifying, by thedatabase manager, the first set of entries, the method may also includedetermining, by the database manager, that there is a third set ofdeleted database records located on a same page as the second set ofdatabase records. In response to the determining, by the databasemanager, that there is a third set of deleted database records locatedon a same page as the second set of database records, the method mayfurther include inserting into the database table the first set ofdatabase records using the third set of deleted database records.

One or more embodiments are directed to a system for reusing deleteddatabase records. The system may include a computing device having aprocessor and a memory. The memory may store program instructions. Theprogram instructions executable by the processor cause the system toreceive a first query request to insert, into a database table, a firstset of database records. The program instructions executable by theprocessor may further cause the system to identify a first set ofentries within a journal log bundle, the first set of entriescorresponding to a second set of database records that have beenmodified within the database table. In response to identifying a firstset of entries within a journal log bundle, the program instructions mayalso cause the system to determine that there is a third set of deleteddatabase records located on a same page as the second set of databaserecords. In response to determining that there is a third set of deleteddatabase records located on a same page as the second set of databaserecords, the program instructions may further cause the system to insertinto the database table the first set of database records using thethird set of deleted database records.

One or more embodiments are directed to a computer program product thatincludes a computer readable storage medium having program code embodiedtherewith. The program code comprising computer readable program codemay be configured for receiving a first query request to insert, into adatabase table, a first set of database record. The program code may befurther configured for identifying a first set of entries within ajournal log bundle, the first set of entries corresponding to a secondset of database records that have been modified within the databasetable. In response to identifying a first set of entries within ajournal log bundle, the program code may also be configured fordetermining that the second set of database records are located on afirst page and that a second set of entries within the journal logbundle correspond to a third set of deleted database records located ona second page. In response to determining that a second set of entrieswithin the journal log bundle correspond to a third set of deleteddatabase records located on a second page, the program code may beconfigured for inserting into the database table the first set ofdatabase records using the third set of deleted database records.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating one embodiment of an exampledatabase manager.

FIG. 2 is a block diagram of one embodiment of an example of a computingdevice that includes a memory with database manager instructions.

FIG. 3 is a block diagram illustrating an example embodiment of thestorage engine of FIG. 2.

FIG. 4 is a flow diagram of one embodiment of an example process fordetermining whether a deleted database record(s) is available on thesame page as a prior modification in a current log journal bundle.

FIG. 5 is one embodiment of an example database file table that includesvarious pages, columns, and deleted database records, according toembodiments.

While embodiments described herein are amenable to various modificationsand alternative forms, specifics thereof have been shown by way ofexample in the drawings and will be described in detail. It should beunderstood, however, that the intention is not to limit the invention tothe particular embodiments described. On the contrary, the intention isto cover all modifications, equivalents, and alternatives falling withinthe spirit and scope of the invention.

DETAILED DESCRIPTION

Aspects of the present disclosure relate to database management systems,more particular aspects relate to reusing deleted database records.While the present disclosure is not necessarily limited to suchapplications, various aspects of the disclosure may be appreciatedthrough a discussion of various examples using this context.

When a previously deleted database record (flagged database record) isselected to become a new inserted database record, the previouslydeleted record may be selected from an arbitrary position within adatabase table. For example, a user may issue a query to insert adatabase record. The database manager may select a previously deletedrecord in the table located on page 1, which may not be part of acurrent journal log bundle. Accordingly, the selection of the previouslydeleted database record may cause unnecessary additional input/output(I/O) operations needed to make database table changes, as the databasemanager may have to write the reusing of the deleted database recordslocated on page 1, and the write the journal log bundle in two or moreseparate I/O operations. Therefore, embodiments of the presentdisclosure are directed to reusing deleted database records located on asame page (or close to the same page) as a current modification within ajournal log bundle, which may increase the efficiency of I/O operationsperformed.

When a particular database record is inserted, updated, or deleted, ajournal manager may cache or buffer the change in memory as an entry toa journal log. The entry may specify the data that was changed, anidentification number (e.g., a Relative Record Number (RRN)), and theparticular time of the operation, which may be useful for recoverypurposes. These and other entries in the journal log may be bundledtogether before the bundle reaches a particular write size (e.g., anoptimal write size of 128 k). In various embodiments, only when thebundle reaches the particular write size, is the bundled informationwritten to a storage device (e.g., disk). When a user performs amulti-operational transaction, the user may perform a first operation(e.g., update a database record) and an insert operation at a latertime. In some embodiments, the database manager may utilize the firstoperation entry within the bundle of a journal log to find acorresponding page of the first operation, as described in more detailbelow. Accordingly, a database manager may find previously deleteddatabase records located on the same page as a first operation tocomplete an insert operation. These changes may therefore be written tothe storage device during a single I/O operation, as opposed to multipleI/O operations.

FIG. 1 is a block diagram of one embodiment of an example databasemanager 132. In an embodiment, the database manager 132 may include aquery processor 134 and a storage engine 136, which may interact with aone or more database files 110 within a storage device 128. In someembodiments, the components and data shown in FIG. 1 may includeinstructions or statements that execute on a processor, such as theprocessor 206 in FIG. 2, or instructions or statements that areinterpreted by instructions or statements that execute on the processor206 to carry out the functions as further described below. In addition,in some embodiments, the components shown in FIG. 1 may be implementedin hardware via semiconductor devices, chips, logical gates, circuits,circuit cards, and/or other physical hardware devices in lieu of, or inaddition to, a processor-based system. In an embodiment, the componentsshown in FIG. 1 may include data in addition to instructions orstatements.

In various embodiments, these components and data are operable toreceive a query request to insert, into a database table, a first set ofdatabase records located on a first page, and to determine that there isa first set of deleted database records located on the first page. Inresponse to the determining that there is a set of deleted databaserecords located on the first page, the components and data are furtheroperable to insert, into the database table, the set of database recordsusing the first set of deleted database records. The phrase “set of”(e.g., set of database records), as discussed herein shall mean at leastone of.

Consistent with some embodiments, a user may issue a query request andthe database manager 132 may receive the query request to modify a setof database records. For example, a user may issue a first query requestto delete a first set of database records located on a first page. Auser may then issue a second query request to insert a second set ofdatabase records located on the first page. In an embodiment of thepresent disclosure, the database manager reuses the first, deleted setof database records from the first query request to insert the second,new set of database records into a table of the database file 110, asdescribed below. In some embodiments, the query request may also specifyupdating a set of database values within a set of database records. Thequery request may be written in any suitable query language thatcorresponds to the desired database type. For example, the query requestmay be written in structured query language (SQL) for relationaldatabases, data manipulation language (DML) for inserting, updating, ordeleting database records in relational databases, multidimensionalexpression (MDX) for multidimensional or online analytical procession(OLAP) databases, or any other language for any other database.

In an embodiment, the database manager 132 may initiate the process ofselecting the one or more database records that are being requested fromthe query request by utilizing the query processor 134. The queryprocessor 134 may generate several plans to access database records andexecute the most efficient plan, as explained further below.Alternatively, the query processor 134 may generate an efficient plan,which is not necessarily the most efficient. The query processor 134 mayinclude such components as a compiler, a parser engine, an optimizerengine, and an execution engine. A compiler may receive the queryrequest and convert the query request into machine-readable object code.

The parser engine may receive the compiled query request and check thatthe query request is correctly specified, resolve names and references,and convert the query request into a format utilized by the optimizerengine. The parser engine may convert the query request into a datastructure, which gives a structural representation of the query request.For example, the data structure may be an abstract syntax tree, parsetree, or other data structure. In various embodiments, the parser enginemay make a plurality of checks, including a syntax check, a checkdetermining whether the query request is meaningful (e.g., whetherobjects and columns in the query request exist), and a shared poolcheck.

In various embodiments, the optimizer engine receives the parsed queryrequest and in response determines an efficient or most efficient queryexecution plan of selecting the one or more database records based onwhich database record(s) are requested in the query request. This mayoccur by determining the cost of each query execution plan through anestimator. In an embodiment, an estimator may estimate the cost of eachquery execution plan by measuring the units of work or resources used.For example, the estimator may use disk I/O, central processing unit(CPU) usage, and memory usage to calculate units of work. The cost of aquery execution plan may accordingly represent a number of work unitsthat are expected to be absorbed when the query request is executed andthe results produced. In an embodiment, the execution engine receives anefficient or most efficient query execution plan according to theoptimizer engine, and executes the query against the database files 110.The execution engine may also order tables in any particular join orderaccording to any join method, which is chosen by the optimizer engine.For example, the execution engine may run a nested loop, sort merge, orhash method as the join method chosen by the optimizer engine.

In various embodiments, the storage engine 136 uses the chosen queryexecution plan from the query processor 134 to select one or moredatabase records from the database files 110. In other embodiments, theone or more database records are stored in the same memory, such asmemory 212 in FIG. 2, as instructions or statements for executing one ormore of the functions of the database manager 132, and are therefore beselected from the memory 212. In some embodiments, the storage engine136 is a part of the execution engine of the query processor 134. Thestorage engine 136 provides an interface between low level data storedin database files 110 and higher level applications. The storage engine136 may interface with the database files 110 by translating variousquery requests into low-level file system commands. For example, thestorage engine 136 may be responsible for the actual inserting ordeleting (or updating of values) of database records from a table withinthe database files 110.

FIG. 2 is a block diagram of one embodiment of an example computingdevice that includes a memory with database manager instructions. Thecomponents of the computing device 200 can include one or moreprocessors 206, a memory 212, a terminal interface 218, a storageinterface 220, an Input/Output (“I/O”) device interface 222, and anetwork interface 224, all of which are communicatively coupled,directly or indirectly, for inter-component communication via a memorybus 210, an I/O bus 216, bus interface unit (“IF”) 208, and an I/O businterface unit 214.

The computing device 200 may include one or more general-purposeprogrammable central processing units (CPUs) 206A and 206B, hereingenerically referred to as the processor 206. In an embodiment, thecomputing device 200 may contain multiple processors; however, inanother embodiment, the computing device 200 may alternatively be asingle CPU device. Each processor 206 executes database managerinstruction 202 stored in the memory 212, which may be identical to thedatabase manager 132 of FIG. 1.

The computing device 200 may include a bus interface unit 208 to handlecommunications among the processor 206, the memory 212, the displaysystem 204, and the I/O bus interface unit 214. The I/O bus interfaceunit 214 may be coupled with the I/O bus 216 for transferring data toand from the various I/O units. The I/O bus interface unit 214 maycommunicate with multiple I/O interface units 218, 220, 222, and 224,which are also known as I/O processors (IOPs) or I/O adapters (IOAs),through the I/O bus 216. The display system 204 may include a displaycontroller, a display memory, or both. The display controller mayprovide video, audio, or both types of data to a display device 202. Thedisplay memory may be a dedicated memory for buffering video data. Thedisplay system 204 may be coupled with a display device 202, such as astandalone display screen, computer monitor, television, a tablet orhandheld device display, or another other displayable device. In anembodiment, the display device 202 may include one or more speakers forrendering audio. Alternatively, one or more speakers for rendering audiomay be coupled with an I/O interface unit. In alternate embodiments, oneor more functions provided by the display system 204 may be on board anintegrated circuit that also includes the processor 206. In addition,one or more of the functions provided by the bus interface unit 208 maybe on board an integrated circuit that also includes the processor 206.

The I/O interface units support communication with a variety of storageand I/O devices. For example, the terminal interface unit 218 supportsthe attachment of one or more user I/O devices, which may include useroutput devices (such as a video display devices, speaker, and/ortelevision set) and user input devices (such as a keyboard, mouse,keypad, touchpad, trackball, buttons, light pen, or other pointingdevices). A user may manipulate the user input devices using a userinterface, in order to provide input data and commands to the user I/Odevice 226 and the computing device 200, and may receive output data viathe user output devices. For example, a user interface may be presentedvia the user I/O device 226, such as displayed on a display device,played via a speaker, or printed via a printer.

The storage interface 220 supports the attachment of one or more diskdrives or direct access storage devices 228 (which are typicallyrotating magnetic disk drive storage devices, although they couldalternatively be other storage devices, including arrays of disk drivesconfigured to appear as a single large storage device to a hostcomputer, or solid-state drives, such as a flash memory). In anotherembodiment, the storage device 228 may be implemented via any type ofsecondary storage device. The contents of the memory 212, or any portionthereof, may be stored to and retrieved from the storage device 228 asneeded. The I/O device interface 222 provides an interface to any ofvarious other I/O devices or devices of other types, such as printers orfax machines. The network interface 224 provides one or morecommunication paths from the computing device 200 to other digitaldevices and computer systems.

Although the computing device 200 shown in FIG. 2 illustrates aparticular bus structure providing a direct communication path among theprocessors 206, the memory 212, the bus interface 208, the displaysystem 204, and the I/O bus interface unit 214, in alternativeembodiments the computing device 200 may include different buses orcommunication paths, which may be arranged in any of various forms, suchas point-to-point links in hierarchical, star or web configurations,multiple hierarchical buses, parallel and redundant paths, or any otherappropriate type of configuration. Furthermore, while the I/O businterface unit 214 and the I/O bus 208 are shown as single respectiveunits, the computing device 200, may include multiple I/O bus interfaceunits 214 and/or multiple I/O buses 216. While multiple I/O interfaceunits are shown, which separate the I/O bus 216 from variouscommunication paths running to the various I/O devices, in otherembodiments, some or all of the I/O devices are connected directly toone or more system I/O buses.

In various embodiments, the computing device 200 is a multi-usermainframe computer system, a single-user system, or a server computer orsimilar device that has little or no direct user interface, but receivesrequests from other computer systems (clients). In other embodiments,the computing device 200 may be implemented as a desktop computer,portable computer, laptop or notebook computer, tablet computer, pocketcomputer, telephone, smart phone, or any other suitable type ofelectronic device.

In an embodiment, the memory 212 may include a random-accesssemiconductor memory, storage device, or storage medium (either volatileor non-volatile) for storing or encoding data and programs. In anotherembodiment, the memory 212 represents the entire virtual memory of thecomputing device 200, and may also include the virtual memory of othercomputer systems coupled to the computing device 200 or connected via anetwork 230. The memory 212 may be a single monolithic entity, but inother embodiments the memory 212 may include a hierarchy of caches andother memory devices. For example, memory may exist in multiple levelsof caches, and these caches may be further divided by function, so thatone cache holds instructions while another holds non-instruction data,which is used by the processor. Memory 212 may be further distributedand associated with different CPUs or sets of CPUs, as is known in anyvarious so-called non-uniform memory access (NUMA) computerarchitectures.

The memory 212 may store all or a portion of the components and datashown in FIG. 1 (e.g., database manager 132). These programs and datastructures are illustrated in FIG. 2 as being included within the memory212 in the computing device 200; however, in other embodiments, some orall of them may be on different computer systems and may be accessedremotely, e.g., via a network 230. The computing device 200 may usevirtual addressing mechanisms that allow the programs of the computingdevice 200 to behave as if they only have access to a large, singlestorage entity instead of access to multiple, smaller storage entities.Thus, while the components and data shown in FIG. 2 are illustrated asbeing included within the memory 212, these components and data are notnecessarily all completely contained in the same storage device at thesame time. Although the components and data shown in FIG. 2 areillustrated as being separate entities, in other embodiments some ofthem, portions of some of them, or all of them may be packaged together.

FIG. 2 is intended to depict representative components of the computingdevice 200. Individual components, however, may have greater complexitythan represented in FIG. 2. In FIG. 2, components other than or inaddition to those shown may be present, and the number, type, andconfiguration of such components may vary. Several particular examplesof additional complexity or additional variations are disclosed herein;these are by way of example only and are not necessarily the only suchvariations. The various program components illustrated in FIG. 2 may beimplemented, in various embodiments, in a number of different ways,including using various computer applications, routines, components,programs, objects, modules, data structures etc., which may be referredto herein as “software,” “computer programs,” or simply “programs.”

FIG. 3 is a block diagram illustrating an example embodiment of thestorage engine 136 of FIG. 1. In an embodiment, the storage engine 136may include a transaction manager 301, a journal manager 303, and abuffer manager 305.

The transaction manager 301 may be responsible for coordinating varioustransactions (also known as commit cycles) within the database files110. A transaction is one or more operations that make up a unit of workperformed against a storage device. For example, a transaction mayinclude the I/O operations of deleting a database record, and insertinga new database record. In various embodiments, a transaction may be inmultiple states. For example, the transaction may be in an active state(uncommitted state). In an active state, a transaction has begun and iscurrently being executed by the transaction manager 301, which may bethe initial state of every transaction. The transaction may also be in apartially committed state (uncommitted state). In a partially committedstate, the transaction manager 301 may execute its final operationwithout performing various checks (e.g., the consistency state of adatabase file 110 after applying output of the transaction on thedatabase file 110). Moreover, the transaction may be in a committedstate. If the transaction manager 301 executes all of its operationssuccessfully, which includes successfully performing various checks,then the transaction may be in a committed state. Accordingly, all ofthe committed transactions may permanently be applied to the databasefiles 110 within the storage device 128. The transaction may also be ina failed state (uncommitted state). If any checks fail, the transactionmay be in a failed state such that the transaction can no longerproceed. If any of the checks fail, and the transaction is in a failedstate, the transaction manager 301 may “rollback” any uncommittedtransactions to place the database file 110 in a state prior to thestart of the execution of the transaction, which is called an abortedstate (e.g., re-start, kill transaction).

Consistent with some embodiments, the transaction manager 301 maycommunicate with a journal manager 303 to write various uncommittedtransactions to a journal log (also known as a transaction log, commitlog, or journal receiver). The journal manager 303 may be responsiblefor that actual writing of various transaction operations to the journallog. The journal log may include entries (e.g., log sequence numbers(LSNs)) that specify identification numbers of database record(s) (e.g.,relative record numbers (RRNs)) and corresponding operational changes tothe database files 110. For example, the operational changes that may belogged are insert, update, or delete operations of various databaserecords. A RRN may indicate the database record's logical position in adatabase file 110. For example, relative record numbers of the first,third, and fifth database records in a table may be 1, 3, and 5respectively, as illustrated in FIG. 5. The entries may also specify atime stamp to determine when the operational change occurred. Theseentries may be useful for recovery purposes (e.g., snapshot andpoint-in-time recovery). A series of entries in a journal log may beconsidered a journal bundle. The journal bundle may be cached orbuffered in the memory 112 until a threshold write size occurs (e.g., anoptimal write size of 128K). In embodiments, when the threshold writesize occurs, the journal bundle may only then be written to a storagedevice 128. For example, when various changes to database record(s) aremade and written to the journal log in memory 112, the journal manager303 may “pin” the database record(s) to temporarily prevent writing(e.g., paging out) to the storage device (i.e., prevent actual databasechanges to occur within the database file on disk). When the journalbundle reaches the threshold write size, the pins may be released suchthat the bundle is written to the storage device 128. This may occur toallow for journal log changes to properly be written to the storagedevice 128 for recovery purposes.

In some embodiments, the “pinning” of a first database record may allowfor the reuse of deleted database records located on the same page asthe first database record. For example, if a user transaction includestwo insert operations, the user's first insert operation may be loggedas an entry within the journal log. The database manager may “pin” theentry (along with the corresponding bundle) so that it is not written todisk. This may allow the user to utilize the first insert operationdatabase record to find a deleted database record located on the samepage as the first insert operation. This may allow the user to use adeleted database record for the second insert operation, as describedfurther below. In some embodiments, a first transaction may utilize anoperation of a second transaction to find deleted database records aslong as the second transaction's operations are included in a samejournal log bundle. For example, if a first transaction included anupdate operation, a second transaction that included an insert operationmay utilize the update operation from the first transaction to finddeleted rows, as long as the first transaction's operations were a partof the same journal bundle.

In various embodiments, the journal manager 303 and journal log areutilized to determine whether a deleted database record is located onthe same page as a first operation. In an illustrative example, at afirst time a user issues a query request to delete a database record i,wherein a journal manager 303 inserts a LSN entry to a journal logbundle specifying that a deleting operation of database record ioccurred at the first time. At a second time, the user issues a queryrequest to insert a database record. In some embodiments, the databasefile 110 that corresponds to the insert operation has as an attribute,the REUSE DLT (*YES) default operation such that the reusing of deleteddatabase records may be used for inserting the database record.

At a third time, the journal manager 303 determines whether there is apreviously deleted record available on the same page as the deleteddatabase record i. The journal manager 303 may do this by scanning(reading) the journal log and identifying that the database record ientry within the journal includes a particular RRN. A buffer manager 305may then utilize an index or other object to match the RRN from thejournal log to the corresponding RRN of the database record i located inthe database file 110. In some embodiments, the matching occurs bymultiplying the journal log RRN (e.g., RRN 12) by database record ilength (e.g. 4 k) to locate the RRN in the database file 110. Thedatabase record i RRN within the database file 110 includes a page thatthe database record i is on. Accordingly, the buffer manager 305 scansthe corresponding page and selects the deleted database record i as therecord to be used for the inserting operation.

The buffer manager 305 may be responsible for interfacing with thestorage device 128 by reading storage device 128 pages into main memorypages in the manner described above. According to embodiments, in orderfor the buffer manager 305 to perform an operation, the buffer manager305 may select one or more previously deleted database records that arerequested based on an insert query request. In various embodiments, thebuffer manager 305 may select the one or more database records from thememory 112 or different types of database files 110 using variousselection techniques. For example, the one or more database records maybe selected from a database table data structure, and may have a RRN, asdescribed above. In another embodiment, the data structure may be asimple file such as a binary large object (BLOB), or a character largeobject (CLOB). Alternatively, the data structure may be arrays withfixed-length entries, or a linked list. In an embodiment, the buffermanager 305 may utilize index structures to access and select thecorresponding set of database records, which groups database recordstogether thereby making it easier for database record access. Forexample, the buffer manager 305 may access a database record byutilizing a hash-based index, or a tree-based index such as a B+ tree.Indexes may also be clustered, non-clustered, primary, secondary, dense,sparse or configured in any other manner. In an alternative embodiment,the buffer manager 305 may utilize a full-table scan, wherein the buffermanager 305 scans database records one at a time until a desired one ormore database records are selected. In other embodiments, the index maybe an offset from a starting table location based on the size of adatabase record multiplied by the number of database records.

The buffer manager 305 may select database records (including deleteddatabase records) from the database file 110 files in various manners.For example, the buffer manager 305 may directly interface with thedatabase files 110 through a block device, such as a raw access storagedevice, wherein the buffer manager 305 bypasses the operating system'scaches and buffers and accesses the database record (also known as adisk block or physical record). Alternatively, the buffer manager 305may select the set of database records through a component of anoperating system, called a disk manager, wherein the disk managerreceives the low-level file system commands from the buffer manager 305and manages disk space for storage in the database 210.

FIG. 4 is a flow diagram of an example process 400 for determiningwhether a deleted database record(s) is available on the same page as aprior modification in a current journal log bundle. In some embodiments,the database manager 132 performs the process 400. The blocks asspecified in process 400 are not limited by the order as illustrated inFIG. 4. Moreover, the process 400 may include more or less blocks thanthe blocks specified in FIG. 4. For example, the process 400 may includeblock 410 without necessarily including block 402.

In some embodiments, the process 400 starts with block 402 when adatabase manager modifies one or more database records as a result of auser query request. In embodiments, the modifications are logged to acurrent journal log bundle. For example, a user may issue a queryrequest to both update a database record and insert another databaserecord. The update may be the modification, and may have a correspondingpage number in a database file as well as a corresponding RRN in thejournal log. The modification in block 402 may be any suitableoperation, such as an insert or delete operation.

In block 410, a database manager may receive a query request to insertone or more database records. Using the example above, this may be apart of the transaction to both update a particular database record andinsert another database record. In other embodiments, the insert requestmay be a separate request as part of a different transaction, but withinthe same journal bundle.

The database manager may then determine in block 404 if there is one ormore previously deleted database records located on the first page. Inembodiments, the database manager may perform this operation when thedatabase employs “reuse deleted database records” as an attribute(REUSEDLT (*YES)). As described in the present disclosure above, thedatabase manager may determine whether the one or more deleted databaserecords are on the first page by reading the journal log entry of themodification to determine the RRN of the modification (e.g., the updateoperation entry using the example above). The database manager, with thehelp of an index, may locate a matching modification RRN in the databasefile. The RRN located in the database file may give the position of thecorresponding page in the database file. Once a page is found, thedatabase manager may scan the database file to determine whether thereare one or more deleted database records on the same page.

If there are not one or more deleted database records located on thefirst page, then the database manager may select and reuse one or moredeleted database records located on a second page at block 408. Inembodiments, this page may be closest to the first page such that thephysical read head of a disk drive may continue forward on the storagedevice disk. For example, if an insert operation occurred on page 2 of adatabase file, and it was discovered that no previously deleted databaserecord was available on page 2, but one was available on page 1 and 3,the previously deleted database record may be chosen from page 3. Inembodiments, this may be because the read head of a disk drive may startat page 1 and move forward to page 3. Accordingly, if deleted databaserecords were selected from page 1, the read head (which may at the endof page 2 because of the first insert operation) may have to movebackwards, which may cause additional and unnecessary I/O cycles. Inblock 408, once the one or more database records are reused on thesecond page, the process 400 may perform block 412, which is describedbelow.

According to embodiments, if there are one or more deleted databaserecords found on the first page, then a database manager may performblock 406 to select and reuse the one or more deleted database recordson the first page to insert the one or more database records.

In block 412, once the deleted database records have been utilized tocomplete an insert query request, the corresponding operation may belogged to the current journal log bundle (e.g., the same journal logbundle that was a part of the modification in block 402). When, thejournal log bundle reaches a particular write size, the pins may bereleased such that the bundle is written to disk at block 414.Accordingly, the operations of the modification (block 402) and thereusing of deleted database records (blocks 408 or 406) may be writtento disk in a single I/O operation. This may have various advantages. Forexample, in a conventional database manager system, the database managermay not find deleted database records in relation to a page of a currentjournal entry (e.g., the database manager does not perform blocks 406 or408). The deleted database records may be accordingly be chosen from anarbitrary page within a database table, which may not be located in acurrent journal bundle. Therefore, in conventional systems, the databasemanager may have to perform at least two different disk I/Ooperations—one operation to write current journal log bundle entries todisk, and one operation to account for the change of reusing a deleteddatabase record not located in a current journal log bundle (e.g., achange already made to disk at a prior time).

FIG. 5 is an illustrative database file table 500 that includes variouspages, columns, and deleted database records, according to embodiments.The example table 500 specifically includes pages 1-4, RRNs 1-15, columnX, which includes data values (e.g., 7, 1, 3, etc.), and other columndata. There are also delete flags (<deleted>) located on RRNs 2, 6, 7,and 12. The delete flags may correspond to previously deleted databaserecords. Accordingly, instead of the column X showing values for thedeleted database records, the delete flag is written over the valuesindicating that a record has been deleted and may not be queried. Invarious embodiments, the RRN column may be implicit or hidden such thatit is not visible to users. In embodiments, the table 500 may includemany more pages, RRNs per page, and various columns that include morevalues.

In an example illustration, during a single transaction, a user maydecide to update a particular database record and insert anotherdatabase record. Accordingly, at a first time the user may issue anupdate query request specifying: “UPDATE MYTable SET Other ColumnData=:hostVar1 WHERE Column X=10.” This query may accordingly request toupdate a value located on page 4 under “Column X” where the value is 10,which is part of RRN 13. In embodiments, after the UPDATE query requesthas run, at a second time, the user may issue an insert query request asfollows: “INSERT Into MYTable values (11, :hostVar2).” When the insertrequest is made, the database manager may scan a current journal logbundle to determine if any of the entries correspond to database recordsthat have been deleted. In the example illustration, the databasemanager may first determine whether there are any deleted databaserecords located on the same page as the UPDATE operation databaserecords. Accordingly, a database manager may utilize the UPDATEoperation RRN 13 from the current journal log bundle to match it to thecorresponding update RRN 13 within memory (shown in FIG. 5). Asillustrated, the only deleted database record on page 4 is RRN 12.Therefore, the database manager may reuse deleted database record RRN 12to insert a new set of database records.

Aspects of the present invention may be a system, a method, and/or acomputer program product. The computer program product may include acomputer readable storage medium (or media) having computer readableprogram instructions thereon for causing a processor to carry outaspects of the various embodiments.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofembodiments of the present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of embodiments of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

1-7. (canceled)
 8. A system for reusing deleted database records, thesystem comprising: a computing device having a processor and a memory;wherein the memory stores program instructions, the program instructionsexecutable by the processor cause the system to: receive a first queryrequest to insert, into a database table, a first set of databaserecords; identify a first set of entries within a journal log bundle,the first set of entries corresponding to a second set of databaserecords that have been modified within the database table; in responseto identifying the first set of entries within a journal log bundle,determine that there is a third set of deleted database records locatedon a same page as the second set of database records; and in response todetermining that there is a third set of deleted database recordslocated on a same page as the second set of database records, insertinto the database table the first set of database records using thethird set of deleted database records.
 9. The system of claim 8, whereinthe program instructions that cause the system to determine that thereis a third set of deleted database records located on a same page as asecond set of database records includes causing the system to: identifya RRN of the first set of entries within the journal log bundle, the RRNspecifying a relative position of the second set of database recordswithin a database file that includes the database table; in response toidentify the RRN, determine that the second set of database records arelocated on the page; and in response to determine that the second set ofdatabase records are located on the page, identify the third set ofdeleted database records located on the page.
 10. The system of claim 8,wherein the program instructions executable by the processor furthercause the system to: write a second set of entries to the journal logbundle in response to the insert into the database table the first setof database records using the third set of deleted database records;determine that the journal log bundle has reached a threshold size; andin response to determine that the journal log bundle has reached athreshold size, write the journal log bundle to a storage device. 11.The system of claim 8, wherein the program instructions executable bythe processor further cause the system to: receive, prior to receivingthe first query request, a second query request, the second queryrequest specifying updating the second set of database records; andupdate the second set of database records.
 12. The system of claim 11,wherein first and second query requests are a part of a sametransaction, wherein the transaction is a unit of work that makes up oneor more database operations.
 13. The system of claim 8, wherein theprogram instructions executable by the processor further cause thesystem to: receive, prior to receiving the first request, a second queryrequest, the second query request specifying deleting the second set ofdatabase records; and set a delete flag for the second set of databaserecords on the page to delete the second set of database records. 14.The system of claim 13, wherein the third set of deleted databaserecords includes the second set of database records.
 15. A computerprogram product comprising a computer readable storage medium havingprogram code embodied therewith, the program code comprising computerreadable program code configured for: receiving a first query request toinsert, into a database table, a first set of database records;identifying a first set of entries within a journal log bundle, thefirst set of entries corresponding to a second set of database recordsthat have been modified within the database table; in response toidentifying a first set of entries within a journal log bundle,determining that the second set of database records are located on afirst page and that a second set of entries within the journal logbundle correspond to a third set of deleted database records located ona second page; and in response to determining that a second set ofentries within the journal log bundle correspond to a third set ofdeleted database records located on a second page, inserting into thedatabase table the first set of database records using the third set ofdeleted database records.
 16. The computer program product of claim 15,wherein determining that the second set of database records are locatedon a first page and that a second set of entries within the journal logbundle correspond to a third set of deleted database records located ona second page, includes: identifying a RRN of the first set of entrieswithin the journal log bundle, the RRN specifying a relative position ofthe second set of database records within a database file that includesthe database table; in response to identifying the RRN of the first setof entries, determining that the second set of database records arelocated on the first page; identifying a RRN of the second set ofentries within the journal log bundle, the second set of entriesspecifying a relative position of the third set of deleted databaserecords within the database file that includes the database table; inresponse to identifying a RRN of the second set of entries, determiningthat the third set of database records are located on the second page.17. The computer program product of claim 15, wherein the program codecomprising computer readable program code is further configured for:writing a third set of entries to the journal log bundle in response tothe inserting into the database table the first set of database recordsusing the third set of deleted database records; determining that thejournal log bundle has reached a threshold size; and in response todetermining that the journal log bundle has reached a threshold size,writing the journal log bundle to a storage device.
 18. The computerprogram product of claim 15, wherein the program code comprisingcomputer readable program code is further configured for: receiving,prior to receiving the first query request, a second query request, thesecond query request specifying updating the second set of databaserecords; and updating the second set of database records.
 19. Thecomputer program product of claim 18, wherein first and second queryrequests are a part of a same transaction, wherein the transaction is aunit of work that makes up one or more database operations.
 20. Thecomputer program product of claim 15, wherein the program codecomprising computer readable program code is further configured for:receiving, prior to receiving the first request, a second query request,the second query request specifying deleting the second set of databaserecords; setting a delete flag for the second set of database records onthe page to delete the second set of database records, wherein the thirdset of deleted database records includes the second set of databaserecords.